#include "CustomConsole.h"
#include "MooseObjectAction.h"
#include "ActionFactory.h"
#include "ActionWarehouse.h"
//
//registerMooseObject("MooseApp", CustomConsole);
//
//template <>
//InputParameters validParams<CustomConsole>()
//{
//	InputParameters params = validParams<Console>();
//	return params;
//}
//
//void CustomConsole::output(const ExecFlagType& flag)
//{
//	//mooseError("CustomConsole::output");
//
//	if (flag == EXEC_INITIAL)
//	{
//		std::cout << "11111111111" << std::endl;
//	}
//}


registerMooseAction("O4App", CustomConsoleAction, "meta_action");
template <>
InputParameters validParams<CustomConsoleAction>()
{
	InputParameters params = validParams<Action>();
	return params;
}

void CustomConsoleAction::act()
{
	mooseError("CustomConsoleAction::act");

	auto _action_params = _action_factory.getValidParams("AddOutputAction");
	std::string object_type = "CustomConsole";
	_action_params.set<std::string>("type") = object_type;


	// Create the complete object name (uses lower case of type)
	std::transform(object_type.begin(), object_type.end(), object_type.begin(), ::tolower);

	// Create the action
	std::shared_ptr<MooseObjectAction> action = std::static_pointer_cast<MooseObjectAction>(
		_action_factory.create("AddOutputAction", object_type, _action_params));

	// Set flag indicating that the object to be created was created with short-cut syntax
	action->getObjectParams().set<bool>("_built_by_moose") = true;

	// Add the action to the warehouse
	_awh.addActionBlock(action);
}
